// 仅SSR使用
export const useHeader = () =>
    useState<Record<string, string>>('header', () => {
        const header = ref({
            'token': '',
            'client-language': '',
        });
        const langQuery = useRoute().query?.['client-language'] || 'en';
        const lang = Array.isArray(langQuery) ? langQuery?.[0] || 'en' : langQuery;

        const tokenQuery = useRoute().query?.['token'] || '';
        const token = Array.isArray(tokenQuery) ? tokenQuery?.[0] || '' : tokenQuery;
        if (lang) {
            header.value['client-language'] = lang;
        }
        if (token) {
            header.value['token'] = token;
        }
        return header;
    });
